@extends('admin::layouts.master')

@section('content')
    <form action="{{route('permission',$roleid)}}" method="post">
        @csrf
<div class="card card-border-color card-border-color-primary">
    <div class="card-header">角色权限分配</div>
    @foreach($permissions as $k=>$v)
    <div class="card-body">
        @foreach($v['rules'] as $kk=>$vv)
        <div class="card-body">
            <div class="form-group row pt-1 pb-1">
                <label class="col-12 col-sm-3 col-form-label text-sm-right">
                    {{$vv['group']}}
                </label>
                <div class="col-12 col-sm-8 col-lg-6 form-check mt-2">
                    @foreach($vv['permissions'] as $vvv)
                        <label class="custom-control custom-checkbox custom-control-inline">
                            <input type="checkbox" @if($role->hasPermissionTo($vvv['name'])) checked @endif name="name[]" value="{{$vvv['name']}}" class="custom-control-input">
                            <span class="custom-control-label">{{$vvv['title']}}</span>
                        </label>
                    @endforeach
                </div>
            </div>
        </div>
        @endforeach
        @endforeach
    </div>
    <button type="submit" class="btn btn-space btn-success btn-lg">保存</button>
    <a href="/admin/role" class="btn btn-space btn-success btn-lg">点击返回</a>
</div>
    </form>

@endsection